home *** CD-ROM | disk | FTP | other *** search
- Path: altair.dur.ac.uk!d3g3gw
- From: Nick Pratt <N.B.Pratt@durham.ac.uk>
- Newsgroups: comp.sys.amiga.programmer
- Subject: C Code prob
- Date: Mon, 8 Jan 1996 21:46:54 +0000
- Organization: University of Durham, Durham, UK.
- Message-ID: <Pine.SOL.3.91-941213.960108214431.23338A-100000@altair.dur.ac.uk>
- NNTP-Posting-Host: altair.dur.ac.uk
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
-
-
- Could anyone help me with this please:
-
- Im trying to code a get around for a program originally coded in MS-DOS
- Turbo C using cprint(). Im tryint to port this prog to my Amiga using the
- curses.lib. However, curses.lib does not print \r control codes, so I
- tried the following:
- void cprintf(const char *fmt, ... )
- {
- char c, newfmt[4096];
- int i=0, j=0, len;
- va_list ap;
-
- va_start(ap,fmt);
-
- len = strlen(fmt);
-
- while( len > (j-1) )
- {
- c = fmt[j++];
-
- if( c == '\r' ) /* Discard any \r's */
- continue;
-
- newfmt[i++] = c; /* Otherwise, copy the char to the new array */
- }
-
- /* printw() is out of curses.lib, and doesnt convert \r */
- printw(newfmt, ?????? );
-
- /* What I now need to do is call printw() with the format string of
- newfmt, and also with all the arguments supplied to cprintf();
-
- Whats the best way to do this?
- */
-
-
- va_end(ap);
-
- return;
- }
-
-
- I can easily remove the \r from the fmt string, but I now need to call
- printw() with the newfmt string and with all the arguments in the var
- args list. Any ideas?
-
- Please crosspost to email as well,
-
- Cheers,
-
- Nick
-
-
- +-----------------------------------------------------------------------------+
- | PGP Key Available: Email with REQUEST PGP as subject |
- | HTTP://www.dur.ac.uk/~d3g3gw FIDO: 2:250/602.1 |
- +-----------------------------------------------------------------------------+
-
-